package com.fadis.cmd;


import java.util.ArrayList;
import java.util.List;

/**
 * 一个指令
 */
public class FadisActionFrame {

    private List<String> args = new ArrayList<>();

    public FadisActionFrame() {
    }

    public void appendArg(String arg){
        args.add(arg);
    }
    public void appendArgs(List<String> args){
        this.args.addAll(args);
    }
    public void appendArgs(String[] args){
        for (int i = 0; i < args.length; i++) {
            this.args.add(args[i]);
        }
    }

    public int getArgsCount() {
        return args.size();
    }

    public List<String> getArgs() {
        return args;
    }

    public String firstArg(){
        return args.size() > 0 ? args.get(0) : null;
    }

    public String getArg(int index){
        if(index < 0 || index >= args.size()) return null;
        return args.get(index);
    }


}
